<nav class="main-header navbar navbar-expand navbar-white navbar-light">
  <!-- Left navbar links -->
  <ul class="navbar-nav">
    <li class="nav-item">
      <a class="nav-link" data-widget="pushmenu" href="#" role="button"
        ><i class="fas fa-bars"></i
      ></a>
    </li>
    <li class="nav-item d-none d-sm-inline-block">
      <a href="{% url 'post:index' %}" class="nav-link">主页</a>
    </li>
    <li class="nav-item d-none d-sm-inline-block">
      <a href="#" class="nav-link">文章</a>
    </li>
  </ul>
  <a
    href="{% url 'appuser:logout' %}"
    class="text-decoration-none text-dark ml-auto nav-link"
  >
    {% if request.user.is_superuser %}
        {{ request.user.username }}
    {% else %}
        Hello <b class="text-danger">{{ request.user.username }}</b>
    {% endif %}
     , 登出</a
  ><!-- 新添加代码 -->
</nav>